package com.howtographql.hackernews;

/**
 * 功能说明：
 *
 * @author xiaoyu
 * @date 2019/2/21
 */

import com.coxautodev.graphql.tools.GraphQLRootResolver;
import com.howtographql.hackernews.link.Link;
import com.howtographql.hackernews.link.LinkFilter;
import com.howtographql.hackernews.link.LinkRepository;

import java.util.List;

/**
 *
 * @description
 * @version 1.0
 * @author Administrator
 * @date 2019/2/21 11:49
 *
 */
public class Query implements GraphQLRootResolver {
    private final LinkRepository linkRepository;

    public Query(LinkRepository linkRepository) {
        this.linkRepository = linkRepository;
    }

    public List<Link> allLinks(LinkFilter filter, Number skip, Number first) {
        return linkRepository.getAllLinks(filter, skip.intValue(), first.intValue());
    }

}
